package com.credit.repository;

import java.util.List;

import javax.persistence.QueryHint;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.QueryHints;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.credit.entity.CreditLoanLog;

public interface CreditLoanLogDao extends PagingAndSortingRepository<CreditLoanLog, Long>, JpaSpecificationExecutor<CreditLoanLog> {

	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
	CreditLoanLog findByLoanId(int loanId);

	@Query("from CreditLoanLog log where log.loanId = ?1 and log.userId=?2 and log.appType=?3")
	List<CreditLoanLog> findLoanLogByLoanIdAndUid(Long loanId, Long userId,int appType);

	@Query("from CreditLoanLog log where log.loanId = ?1 and log.userId=?2 and log.processFlag=?3 and log.processStatus=?4 and log.appType=?5")
	CreditLoanLog findLoanLogByLoanIdAndUid(Long loanId, Long userId, Integer processFlag,Integer processStatus,int appType);

}
